package com.google.projectulator;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.maven.project.MavenProject;

/**
 * The context under which a projectulator processing occurs.
 * @author Lance Woodson
 *
 */
public class Context {
	private ProjectCollectorState projectCollector;
	private ProjectState originalProject;
	private ProcessorState preProcessorState;
	private List<ProjectState> projects;
	private ProjectState currentProject;
	private ProcessorState currentProcessor;
	private ProcessorState postProcessorState;
	private Map<String, Object> properties;
	private boolean continuing;
	
	public Context(MavenProject mavenProject, ProjectCollector projectCollector, Processor preProcessor, Processor postProcessor) {
		this.projectCollector = new ProjectCollectorState(projectCollector);
		this.originalProject = new ProjectState(mavenProject);
		this.preProcessorState = new ProcessorState(preProcessor);
		this.postProcessorState = new ProcessorState(postProcessor);
		projects = new ArrayList<ProjectState>();
		properties = new HashMap<String, Object>();
		continuing = true;
	}
	
	public ProjectCollectorState getProjectCollector() {
		return projectCollector;
	}
	
	public void setProjectCollector(ProjectCollectorState projectCollector) {
		this.projectCollector = projectCollector;
	}
	
	public ProjectState getOriginalProject() {
		return originalProject;
	}
	
	public void setOriginalProject(ProjectState originalProject) {
		this.originalProject = originalProject;
	}
	
	public List<ProjectState> getProjects() {
		return projects;
	}
	
	public void setProjects(List<ProjectState> projects) {
		this.projects = projects;
	}
	
	public ProjectState getCurrentProject() {
		return currentProject;
	}
	
	public void setCurrentProcessor(ProcessorState currentProcessor) {
		this.currentProcessor = currentProcessor;
	}
	
	public ProcessorState getCurrentProcessor() {
		return currentProcessor;
	}
	
	public void setCurrentProject(ProjectState currentProject) {
		this.currentProject = currentProject;
	}
	
	public ProcessorState getPreProcessorState() {
		return preProcessorState;
	}
	
	public void setPreProcessorState(ProcessorState preProcessorState) {
		this.preProcessorState = preProcessorState;
	}
	
	public ProcessorState getPostProcessorState() {
		return postProcessorState;
	}
	
	public void setPostProcessorState(ProcessorState postProcessorState) {
		this.postProcessorState = postProcessorState;
	}
	
	public Object getProperty(String name) {
		return properties.get(name);
	}
	
	public void setProperty(String name, Object value) {
		properties.put(name, value);
	}
	
	public boolean isContinuing() {
		return continuing;
	}
	
	public void setContinuing(boolean continuing) {
		this.continuing = continuing;
	}
}